<?php
/*
  $Id: FAQDesk 2.3

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General  License
*/

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FAQ);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_FAQ));

  require(DIR_WS_INCLUDES . 'template_top.php');
?>
<script language="JavaScript">
    function showItem(id){
         var item = document.getElementById(id);
         if (item){
               if (!item.style.display || item.style.display == '' )
                   item.style.display = 'none';
               else
                   item.style.display = '';
         }
   }
</script>

<h1><?php echo HEADING_TITLE; ?></h1>

<p><?php echo TEXT_CLICK_REVEAL; ?></p>

<div class="contentContainer">
  <div class="contentText">
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
  $faq_query = tep_db_query('select f.faq_id, fd.faq_question, fd.faq_answer, f.last_modified, f.sort_order, f.faq_status from '.TABLE_FAQ.' f,  '.TABLE_FAQ_DESCRIPTION.' fd where f.faq_id=fd.faq_id and f.faq_status and fd.language_id=' . (int)$languages_id . ' order by f.sort_order, fd.faq_question');
      $count = 1;
      while($faq = tep_db_fetch_array($faq_query)){
?>
      <tr>
         <td class="main"><b style="cursor:pointer;" onclick="showItem('faq_answer_<?php echo $faq['faq_id'];?>')"><?php echo $count . '. ' . $faq['faq_question'];?></b></td>
      </tr>
      <tr>
         <td style="padding-top:5px;display:none;" id="faq_answer_<?php echo $faq['faq_id'];?>">
            <table border="0" cellspacing="0" cellpadding="2">
               <tr>
                  <td class="main"><?php echo $faq['faq_answer'];?></td>
               </tr>
               <tr>
                  <td class="smallText"><?php echo TEXT_LAST_UPDATED . $faq['last_modified'];?></td>
               </tr>
           </table></td>
      </tr>
      <tr>
         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10')?></td>
      </tr>
<?php
        $count++;
      }
?>
    </table>
  </div>

  <div class="buttonSet">
    <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?></span>
  </div>
</div>

<?php
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
